package demo7;

import java.util.*;

public class test {
    public static void main(String[] args) {
        Map<Integer,Integer> map = new TreeMap<>();
        map.put(1,1);
        map.put(2,2);
        map.put(3,3);
        map.put(4,4);
        System.out.println(map.get(1));



        //返回key的数据集
        Set<Integer> set = map.keySet();
        System.out.println(set);
        //返回value的数据集
        Collection<Integer> collections = map.values();
        System.out.println(collections);

        //返回所有key-value键值对映射关系
        Set<Map.Entry<Integer,Integer>> set1 = map.entrySet();
        System.out.println(set1);

        System.out.println(map.getOrDefault(5, 2));

        Map.Entry<Integer,Integer> e = null;
        e.setValue(1);
        System.out.println(e.getValue());

    }

}
